// const { createClient } = require("webdav");
import { createClient } from "webdav";

const client = createClient(
    "http://localhost:2000",
    {
        username: "username",
        password: "password"
    }
);

async function uploadFile() {
    // Get directory contents
    const directoryItems = await client.getDirectoryContents("/");
    console.log(directoryItems);
    // Outputs a structure like:
    // [{
    //     filename: "/my-file.txt",
    //     basename: "my-file.txt",
    //     lastmod: "Mon, 10 Oct 2018 23:24:11 GMT",
    //     size: 371,
    //     type: "file"
    // }]
}
uploadFile();